/*************************************************************************
 *
 * $Id: datetime.h 23 2006-06-24 14:40:27Z alpov $
 * 
 *************************************************************************/         

#ifndef _DATETIME_H
#define _DATETIME_H

#include <avr/pgmspace.h>

#define __isleap(y) (((y) % 4) ? 0 : 1)

extern unsigned char PROGMEM month_days[2][12];

extern unsigned long time_of(unsigned long datetime);
extern unsigned long date_of(unsigned long datetime);
extern unsigned long encode_datetime(unsigned char year, unsigned char month, \
	unsigned char day, unsigned char hour, unsigned char min, unsigned char sec);
extern void decode_time(unsigned long datetime, unsigned char *hour, \
	unsigned char *min, unsigned char *sec);
extern unsigned char day_of_week(unsigned long datetime);
extern void decode_date(unsigned long datetime, unsigned char *year, \
	unsigned char *month, unsigned char *day);

#endif
